<?php
/**
 *  护理配置子项 字典 模型
 * @authors xiadx (xiadx@zpdchina.com)
 * @date    2017-03-06 16:20:43
 * @version $Id$
 */

class DataDictionaryModel extends BaseModel {

    public function ls($dict_name = [])
    {
        if (empty($dict_name)) {
            return [];
        }
    	$query = DB::select('dict_name,dictdata_name,isfixed')
    				->from('data_dictionary as a')
    				->join('data_dictionarydata as b')
    				->on('a.dict_value', '=', 'b.dict_value')
    				->where('a.yiyuan_id', '=', $this->yiyuan_id)
    				->and_where('a.dict_name', 'IN',$dict_name)
    				->execute()
    				->as_array();
		$data = [];
		foreach ($query as $value) {
			foreach ($dict_name as $id => $dictdata_name) {
				if ($value['dict_name'] == $dictdata_name)
					$data[$id][] = $value;
			}
		}
		return $data;

    }
}
